<div>
  <form nz-form [formGroup]="validateForm">

    <div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSpan]="6">
        <label nz-form-item-required>维保单位</label>
      </div>
      <div nz-form-control nz-col [nzSpan]="8" nzHasFeedback>
        <nz-input [(ngModel)]="papelessMaintBean.maintenancePartyName" [nzDisabled]="true" formControlName="maintenancePartyId" name="maintenancePartyId"></nz-input>
        <div nz-form-explain *ngIf="getFormControl('maintenancePartyId').dirty && getFormControl('maintenancePartyId').hasError('required')">维保单位不能为空!</div>
      </div>
    </div>

    <div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSpan]="6">
        <label nz-form-item-required>使用单位</label>
      </div>
      <div nz-form-control nz-col [nzSpan]="8" nzHasFeedback >
        <nz-select  name="userPartyId" nzAllowClear [nzPlaceHolder]="'请选择'"  [(ngModel)]="papelessMaintBean.userPartyId" (ngModelChange)="getUserParty()" [nzShowSearch]="true" formControlName="userPartyId" name="userPartyId">
          <nz-option *ngFor="let option of userPartyList" [nzLabel]="option.firstPartyName" [nzValue]="option.firstParty">
          </nz-option>
        </nz-select>
        <div nz-form-explain *ngIf="getFormControl('userPartyId').dirty && getFormControl('userPartyId').hasError('required')">使用单位不能为空!</div>
      </div>
    </div>

    <div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSpan]="6">
        <label nz-form-item-required>制造单位</label>
      </div>
      <div nz-form-control nz-col [nzSpan]="8" nzHasFeedback >
        <nz-select  name="createCompanyName" nzAllowClear [nzPlaceHolder]="'请选择'"  [nzMultiple]="true" [(ngModel)]="createCompanyName" [nzShowSearch]="true" formControlName="createCompanyName" name="createCompanyName" (nzOpenChange)="getCreateCompanyName()">
          <nz-option *ngFor="let option of createList" [nzLabel]="option.value" [nzValue]="option.value">
          </nz-option>
        </nz-select>
        <div nz-form-explain *ngIf="getFormControl('createCompanyName').dirty && getFormControl('createCompanyName').hasError('required')">制造单位不能为空!</div>
      </div>
    </div>

    <div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSpan]="6">
        <label nz-form-item-required>申请对象</label>
      </div>
      <div nz-col [nzSpan]="8" nz-form-control nzHasFeedback [nzValidateStatus]="getFormControl('jgPartyId')">
        <nz-select nzAllowClear [nzPlaceHolder]="'请选择'" [nzShowSearch]="true" formControlName="jgPartyId" (nzOpenChange)="getJgPartyName()"
                   [nzSize]="'large'" [(ngModel)]="papelessMaintBean.jgPartyId" name="jgPartyId">
          <nz-option *ngFor="let item of jgPartyList" [nzLabel]="item.partyName" [nzValue]="item.id"></nz-option>
        </nz-select>
        <div nz-form-explain *ngIf="getFormControl('jgPartyId').dirty&&getFormControl('jgPartyId').hasError('required')">单位类型不能为空!</div>
      </div>
      <button nz-button nz-col [nzOffset]="2" (click)="addElevator(titleElevator, contentElevator, footerElevator)"  [nzType]="'primary'"><span>查看电梯详情</span></button>
    </div>
    <!--<div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSpan]="6">
        <label nz-form-item-required>添加电梯</label>
      </div>
      <div nz-col [nzSpan]="8" nzHasFeedback>
        <nz-input [(ngModel)]="papelessMaintBean.elevatorIds" [nzType]="'textarea'" [nzRows]="'5'" formControlName="outsidenumStr" name="outsidenumStr"
                  (click)="addElevator(titleElevator, contentElevator, footerElevator)"></nz-input>
      </div>
      <button nz-button nz-col [nzOffset]="2" (click)="clear()"  [nzType]="'primary'"><span>清除</span></button>
    </div>-->

    <div nz-form-item nz-row>
      <div nz-form-label nz-col [nzSpan]="6">
        <label>其他说明</label>
      </div>
      <div nz-col [nzSpan]="8" nzHasFeedback>
        <nz-input [(ngModel)]="papelessMaintBean.otherNotes" [ngModelOptions]="{standalone: true}" [nzType]="'textarea'" [nzRows]="'5'" name="otherNotes"></nz-input>
      </div>
    </div>

    <div nz-form-item nz-row style="margin-bottom:10px; margin-left: 40px;">
      <div nz-form-control nz-col [nzSpan]="2" [nzOffset]="8">
        <button nz-button class="login-form-button" [nzType]="'primary'" [nzSize]="'large'" [disabled]="showFlag" (click)="submitForm()">添加</button>
      </div>
      <div nz-form-control nz-col [nzSpan]="2">
        <button nz-button class="login-form-button" [nzType]="'primary'" [nzSize]="'large'" (click)="quit()">取消</button>
      </div>
    </div>
  </form>
</div>

<!--添加电梯 start -->
<nz-modal [ngClass]="addElevator">
  <ng-template #titleElevator>
    <span>{{modelTitle}}</span>
  </ng-template>
  <ng-template #contentElevator>
    <nz-collapseset>
      <nz-collapse [nzTitle]="panels.name" [nzActive]="panels.active" [nzDisabled]="panels.disabled">
        <form nz-form>
          <div nz-form-item nz-row>
            <div nz-form-label nz-col [nzXs]="2">
              <label>电梯类型</label>
            </div>
            <div nz-form-control nz-col [nzSpan]="4">
              <nz-select nzAllowClear [nzPlaceHolder]="'请选择'" [nzShowSearch]="true"  [nzSize]="'small'"
                         [(ngModel)]="elevatorInfo.elevatorTypeId" name="elevatorTypeId" [disabled]="false">
                <nz-option *ngFor="let item of elevatorTypes" [nzLabel]="item.label" [nzValue]="item.value"></nz-option>
              </nz-select>
            </div>

            <div nz-form-label nz-col [nzXs]="2">
              <label>电梯编号</label>
            </div>
            <div nz-form-control nz-col [nzSpan]="4">
              <nz-input [nzPlaceHolder]="'请输入'" [(ngModel)]="elevatorInfo.elevatorNum" name="planName">
              </nz-input>
            </div>

            <div nz-form-label nz-col [nzXs]="4">
              <label>是否已有两次以上维保</label>
            </div>
            <div nz-form-control nz-col [nzSpan]="4">
              <nz-select nzAllowClear [nzPlaceHolder]="'请选择'" [nzShowSearch]="true"  [nzSize]="'small'"
                         [(ngModel)]="elevatorInfo.isMaint" name="isInsure" [disabled]="false">
                <nz-option [nzLabel]="'是'" [nzValue]="'是'"></nz-option>
                <nz-option [nzLabel]="'否'" [nzValue]="'否'"></nz-option>
              </nz-select>
            </div>

            <button style="margin-left: 50px"  nz-button  [nzType]="'primary'" (click)="queryElevator()">查询</button>
            <button style="margin-left: 20px"  nz-button   [nzType]="'primary'" (click)="saveElevators()">保存</button>
          </div>
        </form>
      </nz-collapse>
    </nz-collapseset>
    <nz-table #nzTable [nzDataSource]="elevatorList" nzSize="middle" [nzBordered]="true" [nzIsPagination]="false" (nzDataChange)="displayDataChange($event)">
      <thead nz-thead>
      <tr>
        <th nz-th [nzCheckbox]="true">
          <label nz-checkbox [(ngModel)]="allChecked" [nzIndeterminate]="indeterminate" (ngModelChange)="checkAll($event)">
          </label>
        </th>
        <th nz-th>
          <span>电梯编码</span>
        </th>
        <th nz-th>
          <span>电梯类型</span>
        </th>
        <th nz-th>
          <span>电梯安全管理员</span>
        </th>
        <th nz-th>
          <span>电梯安装地址</span>
        </th>
        <th nz-th>
          <span>维保人员</span>
        </th>
        <th nz-th>
          <span>维保人员初次取证时间</span>
        </th>
        <th nz-th>
          <span>是否已有两次以上维保</span>
        </th>
      </tr>
      </thead>
      <tbody nz-tbody>
      <tr nz-tbody-tr *ngFor="let data of elevatorList">
        <td nz-td [nzCheckbox]="true">
          <label nz-checkbox [nzDisabled]="data.disabled" [(ngModel)]="data.checked" (ngModelChange)="refreshStatus($event)">
          </label>
        </td>
        <td nz-td>{{data.elevatorNum}}</td>
        <td nz-td>{{data.elevatorTypeName}}</td>
        <td nz-td>{{data.safeUserName}}</td>
        <td nz-td>{{data.buildAddr}}</td>
        <td nz-td>{{data.maintenanceUserFirstName}}</td>
        <td nz-td>{{data.firstgt | dateFormat}}</td>
        <td nz-td>{{data.isMaint}}</td>
      </tr>
      </tbody>
    </nz-table>
    <nz-pagination [nzPageIndex]="elevatorInfo.currentPage" nzShowTotal [nzTotal]="total" nzShowSizeChanger
                   (nzPageSizeChange)="nzPageSizeChange($event)" (nzPageIndexChange)="nzPageIndexChange($event)"
                   (nzPageIndexClickChange)="nzPageIndexClickChange($event)" [nzPageSize]="elevatorInfo.pageSize"></nz-pagination>
  </ng-template>
  <ng-template #footerElevator>
    <div>
    </div>
  </ng-template>
</nz-modal>
